<?php 

class LoginForm extends My_Form
{	

	public function __construct()
	{
		parent::__construct();
		
		$this->setAction('login')
				->setMethod('post');
		
		// Create and configure username element:
		$email = $this->createElement('text', 'email');
		$email->setDecorators($this->textDecorator);
		$email->setLabel( "Email: ");
		$email->addValidator('regex', false, array('/^[a-z]+/'))
					->addValidator('stringLength', false, array(4, 20))
					->setRequired(true)
					->addFilter('StringToLower');
		
		// Create and configure password element:
		$password = $this->createElement('password', 'password');
		$password->setDecorators($this->textDecorator);
		$password->setLabel( "Hasło: ");
		$password->addValidator('StringLength', false, array(4))
					->setRequired(true);

		$submit = $this->createElement('submit', 'submit', array('label' => 'Zaloguj się!'));
		$submit->setDecorators($this->submitDecorator);
		
		// Add elements to this:
		$this->addElement($email)
					->addElement($password)
					->addElement($submit);		
	}
}

?>
